package com.bolt.report.business.modules.field.service;
import com.bolt.support.base.service.BaseService;
import com.bolt.report.business.modules.field.entity.ReportDbFieldEntity;
import com.bolt.report.business.modules.field.repository.ReportDbFieldRepository;
import com.bolt.report.business.modules.field.dto.ReportDbFieldDTO;
import com.bolt.report.business.modules.field.dto.converter.ReportDbFieldConverter;
import com.bolt.support.spring.jpa.repository.BasicJpaRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
* Auto Generate Javadoc
* @author
* 日期:2021-11-17 11:40:21
* 
**/
@Service
@Transactional(readOnly = true,rollbackFor = Exception.class)
@RequiredArgsConstructor
public class  ReportDbFieldService extends BaseService<ReportDbFieldEntity, String>{
    
    private final ReportDbFieldRepository reportDbFieldRepository;

    @Override
    protected BasicJpaRepository<ReportDbFieldEntity, String> getRepository() {
        return reportDbFieldRepository;
    }

    @Transactional(rollbackFor = Exception.class)
    public void saveOrUpdate( ReportDbFieldDTO dto) {
       ReportDbFieldEntity entity = ReportDbFieldConverter.toEntity(dto);
        save(entity);
    }
}
